
<!doctype html>
<html class="no-js" lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>云印社 | 在线打印</title>
    <link rel="stylesheet" href="/css/foundation.css" />
    <link rel="stylesheet" type="text/css" href="/css/self.css">
    <link rel="stylesheet" type="text/css" href="/css/user.css">
    <link rel="stylesheet" type="text/css" href="/css/foundation-icons.css">
    <script src="/js/modernizr.js"></script>
  </head>
  <body>
<nav class="top-bar" data-topbar role="navigation">
  <ul class="title-area">
    <li class="name">
      <h1><a href="#">云印社</a></h1>
    </li>
    <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
  </ul>
  <section class="top-bar-section">
    <ul class="right">
            <li class="active"><a href="print">提交传单</a></li>
      <li class="has-dropdown">
        <a href="#">个人中心</a>
        <ul class="dropdown">
          <li><a href="order">我的打印</a></li>
          <li class="active"><a href="billing">我的积分</a></li>
          <li><a href="info">个人资料</a></li>
          <li><a href="quit">退出登录</a></li>
        </ul>
      </li>
          </ul>
    <ul class="left">
      <li class="divider"></li>
      <li><a href="/shop/print">主页</a></li>
      <li class="divider"></li>
      <li><a href="#">文库</a></li>
      <li class="divider"></li>
    </ul>
  </section>
</nav>

<div class="collapse user print-main">
<div class="small-2 large-1 columns" style="padding-left:0;">
  <%include("/shop_left.html"){} %>
</div>

<div class="small-10 large-11 columns" id="upload-page">
<div class="main-box print">

  <div class="row">
      <div class="large-12">
        <ul class="breadcrumbs">
          <li><i class="fi-home"></i> <a href="#">客户中心</a></li>
          <li><a href="#">开始打印</a></li>
        </ul>
    </div>
  </div>
  
  <div class="panel row uploadbtn">
    <span class="letf intro"> (目前只支持上传pdf文档，最大10M哦)</span>
    <% if( session.money_enough_flag != null ){ %>
        <span class="letf intro"> 余额不足,请尽快联系平台充值</span>
    <% } %>
    <a id="submit" class="button tiny right disabled" onclick="if(!$(this).hasClass('disabled')){fsub.submit()};">选择打印店12</a>
    <a id="share" class="button tiny right secondary disabled" onclick="if(!$(this).hasClass('disabled')){$('#fsub').attr('action', '/index.php/Home/Print/share.html').submit();};">仅仅分享</a>
  </div>
  <div class="row panel">
    <form action='upload' method="post" enctype="multipart/form-data">
        <input id="File1" runat="server" name="UpLoadFile" type="file" />
        <input type="submit" name="上传" class="btn btn-success" />
        <label> 传单充值金币
            <input type="text" name="gold_num" placeholder="金币数量" value="1" />
        </label>
        <label> 打印所在学校
        <select name="school">
            <%for(school in schools){%>
                <option value="${school.school_id}" selected>${school.school_name}</option>
             <%}%>    
        </select>
      <div class="collapse" id="queue">
      </div>
    </form>
  </div>

</div>
</div>
</div>

<div class="clearfix"></div>
  <%include("/footer.html"){} %>
  <script src="/js/jquery.js"></script>
  <script src="/js/foundation.min.js"></script>

<script type="text/javascript">
    $(function() {
    $('#file_upload').uploadfive({
      'auto'             : true,
      'buttonText'       : '点我上传',
      'buttonClass'      : 'button tiny left',
      'fileType'         : 'application/pdf',
      'formData'         : {
                           },
      'queueID'          : 'queue',
      'uploadScript'     : 'upload',
      'itemTemplate'     : '<div class="large-12 uploadbar uploadifive-queue-item">\
      <div class="title">\
        <span class="img left"><i class="filetype icon-pdf"></i></span>\
        <span class="left name filename"></span>\
        <span class="right delete close"><i class="fi-x"></i></span>\
        <span class="label left sucinfo"></span>\
        <span class="left yenum"></span>\
        <div class="clearfix"></div>\
      </div>\
      <div class="info collapse">\
        <div class="large-2 columns">\
            <select disabled>\
              <option value="0">单面</option>\
              <option value="1" selected>双面</option>\
            </select>\
        </div>\
        <div class="large-2 columns">\
          <select disabled>\
              <option value="a3">A3</option>\
              <option value="a4" selected>A4</option>\
              <option value="a5">A5</option>\
            </select>\
        </div>\
        <div class="large-2 columns fen">\
          <label class="left name">份数：&nbsp;&nbsp;</label>\
          <input type="number" name="number[]" class="number left" value="1">\
        </div>\
        <div class="clearfix"></div>\
      </div>\
      <div class="progress">\
        <div class="meter progress-bar"></div>\
      </div><input type="hidden" name="upfile[]"></div>',
      'onUploadComplete' : function(file, data) {
        var fo = JSON.parse(data);
        console.log(file);
        var ch = $(file.queueItem[0]).find("span.sucinfo");
        var pg = $(file.queueItem[0]).find("span.yenum");
        if (fo['suc'] != 1) {
          ch.html("上传失败，" + fo.info).addClass('alert').show();
        }else{
          ch.html("上传成功").addClass("success").show();
          pg.html("页数：" + fo.pages);
          $(file.queueItem[0]).find("input[name='upfile[]']").val(fo.aid);
        }
      },
      'onQueueComplete' : function(ups){
        $("#submit").removeClass("disabled");
        $("#share").removeClass("disabled");
      },
      'onProgress' : function(file, e){
        var ch = $(file.queueItem[0]).find("span.sucinfo");
        if (e.loaded >= e.total) {
            ch.html("正在转换格式……").show();
        }
      },
      'onAddQueueItem' : function(file) {
        if (!$("#submit").hasClass('disabled')) {
          $("#submit").addClass("disabled");
          $("#share").addClass("disabled");
        };
      }
    });
  });
</script>

  </body>
</html>
